﻿<Window
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
        xmlns:Converter="clr-namespace:Flare.Converter" 
        xmlns:Controls="clr-namespace:Flare.Controls" 
        x:Class="Flare.MainWindow" MinHeight="576" MinWidth="800" 
        DataContext="{Binding RelativeSource={RelativeSource Self}}"
        Title="Факел" Icon="flame4ico.ico" mc:Ignorable="d" Background="WhiteSmoke" BorderThickness="1" BorderBrush="DarkGray"
        d:DesignWidth="1024" d:DesignHeight="576" WindowStyle="None" WindowState="Maximized">
    <Grid>
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="160" />
                <RowDefinition />
            </Grid.RowDefinitions>

            <Grid x:Name="ActiveHead" VerticalAlignment="Top" Background="Transparent" MouseLeftButtonDown="ActiveHead_MouseLeftButtonDown">
                <Line X1="0" Y1="0" X2="0" Y2="42" HorizontalAlignment="Right" Stroke="{DynamicResource ColorBorder}" StrokeThickness="1" Margin="0,0,136,0"/>

                <Border x:Name="MinimizeButton" HorizontalAlignment="Right" VerticalAlignment="Center" Width="32" Height="32" Margin="0,4,88,4" 
					Style="{DynamicResource SelectedBorder}" PreviewMouseLeftButtonDown="MinimizeButton_Click">
                    <Path Data="M0,2 L16,2" Stroke="{DynamicResource ColorText}" StrokeThickness="4"  VerticalAlignment="Center" HorizontalAlignment="Center"/>
                </Border>

                <Border x:Name="CollapseButton" HorizontalAlignment="Right" VerticalAlignment="Center" Width="32" Height="32"  Margin="0,4,52,4" 
					Style="{DynamicResource SelectedBorder}" PreviewMouseLeftButtonDown="CollapseButton_Click">
                    <Path Data="M0,2 L8,2 L8,16 L2,16 L2,2" Stroke="{DynamicResource ColorText}" StrokeThickness="4"  VerticalAlignment="Center" 
                          HorizontalAlignment="Center"/>
                </Border>

                <Border x:Name="CloseButton" HorizontalAlignment="Right" VerticalAlignment="Center" MinWidth="32" MinHeight="32" Margin="0,0,16,0"
					Style="{StaticResource SelectedBorder}" PreviewMouseLeftButtonDown="CloseButton_Click">
                    <Path Data="M1,1 L16,16 M1,16 L16,1" Stroke="{DynamicResource ColorText}" StrokeThickness="4" VerticalAlignment="Center" 
                          HorizontalAlignment="Center"/>
                </Border>
            </Grid>

            <Image Source="/flare;component/logoFlame.png" Margin="40,40,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Height="56" Width="35" />

            <TextBlock Text="факел" VerticalAlignment="Top" FontFamily="Segoe UI Light" UseLayoutRounding="True" FontSize="50" 
                       Foreground="{DynamicResource ColorText}" HorizontalAlignment="Left" Margin="90,30,0,0" SnapsToDevicePixels="True" />

            <TextBox x:Name="FindBlock" Margin="250,53,0,0" VerticalAlignment="Top" 
					HorizontalAlignment="Left" TextChanged="findBlock_TextChanged" Width="320" Visibility="Visible">
                <TextBox.Style>
                    <Style TargetType="{x:Type TextBox}" BasedOn="{StaticResource {x:Type TextBox}}">
                        <Setter Property="MaxLength" Value="15" />
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="{x:Type TextBox}">
                                    <Border BorderBrush="{TemplateBinding BorderBrush}" 
                            Background="{TemplateBinding Background}" 
                            BorderThickness="1">
                                        <Grid>
                                            <TextBlock x:Name="HelpBlock" Text="введите текст для поиска" Visibility="Collapsed" FontSize="18" 
                                       FontStyle="Italic" Foreground="{DynamicResource ColorTextBackground}" VerticalAlignment="Center" 
                                       HorizontalAlignment="Left" Margin="4,0,0,0" IsEnabled="False"/>
                                            <ScrollViewer x:Name="PART_ContentHost" Margin="2" VerticalAlignment="Center" HorizontalAlignment="Stretch"
                                          VerticalContentAlignment="Center" HorizontalContentAlignment="Left" IsEnabled="{TemplateBinding IsEnabled}"/>
                                        </Grid>
                                    </Border>

                                    <ControlTemplate.Triggers>
                                        <MultiDataTrigger>
                                            <MultiDataTrigger.Conditions>
                                                <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsFocused}" Value="False" />
                                                <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=Text.Length}" Value="0" />
                                            </MultiDataTrigger.Conditions>
                                            <Setter Property="Visibility" Value="Visible" TargetName="HelpBlock"/>
                                        </MultiDataTrigger>
                                    </ControlTemplate.Triggers>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </Style>
                </TextBox.Style>
            </TextBox>

            <Border Margin="0,112,0,0" HorizontalAlignment="Stretch" VerticalAlignment="Top"
                    BorderBrush="{DynamicResource ColorBorder}" BorderThickness="0,1,0,1">
                <Grid>
                    <Label Content="&lt;- используйте для перехода по страницам" 
                           Style="{DynamicResource StyleHelpMessage}" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="260,4,0,4" Visibility="Hidden" />
                    <ListBox x:Name="RepeatMenu" Style="{StaticResource StyleMenuRepeater}" 
                             MinHeight="30" MinWidth="50" Margin="40,4,0,4" HorizontalAlignment="Left" SelectionChanged="RepeatMenu_SelectionChanged" />
                </Grid>
            </Border>

            <ContentControl x:Name="Slider" Grid.Row="1" Margin="40" 
                            HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch">
                <Label Content="инициализация приложения.." VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="28" 
                       Foreground="{DynamicResource ColorBorder}"/>
            </ContentControl>
        </Grid>

        <ListBox x:Name="FuncPanel" Style="{StaticResource FunctionPanel}" />

        <Label x:Name="NoticeContent" MouseDown="NoticeContent_MouseDown" Content="{x:Null}">
            <Label.Style>
                <Style TargetType="{x:Type Label}">
                    <Setter Property="VerticalAlignment" Value="Stretch" />
                    <Setter Property="HorizontalAlignment" Value="Stretch" />
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="{x:Type Label}">
                                <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Panel.ZIndex="99" Background="#B2000000">
                                    <Grid VerticalAlignment="Center" HorizontalAlignment="Stretch" MinHeight="140" Background="WhiteSmoke">
                                        <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" TextWrapping="Wrap" FontFamily="Segoe UI Light"
                                                   Margin="16" FontSize="24" Foreground="{DynamicResource ColorText}" Text="{TemplateBinding Content}" />
                                    </Grid>
                                </Grid>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                    <Style.Triggers>
                        <Trigger Property="Content" Value="{x:Null}">
                            <Setter Property="Visibility" Value="Collapsed" />
                        </Trigger>
                    </Style.Triggers>
                </Style>
            </Label.Style>
        </Label>
    </Grid>
</Window>
